package com.ssy.lingxi.after.sale.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 退货退款外部状态
 * @author 伍将
 * @date 2020/9/24
 * @version 2.0.0
 */
public enum ReturnGoodsRefundOuterStatusEnum {

    /**
     * 所有
     */
    ALL(0, "所有"),
    /**
     * 待退款
     */
    TO_BE_REFUND(1, "待退款"),
    /**
     * 待确认退款
     */
    TO_BE_CONFIRM_REFUND(2, "待确认退款"),
    /**
     * 退款未到账
     */
    REFUND_FAIL(3, "退款未到账"),
    /**
     * 退款到账
     */
    REFUND_SUCCEED(4, "退款到账"),
    /**
     * 无需退款
     */
    UN_NEED_REFUND(5, "无需退款");

    private final Integer code;
    private final String message;

    ReturnGoodsRefundOuterStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getDeclaringClass(), this.getCode());
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(ReturnGoodsRefundOuterStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }
}
